// ignore_for_file: prefer_final_fields
// ignore_for_file: file_names, prefer_const_literals_to_create_immutables, prefer_const_constructors, camel_case_types, avoid_print



import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:guo_xue_app/util/picker_utils.dart';

import '../../pages.dart';

class BaziXuanzePage extends StatefulWidget {
  const BaziXuanzePage({Key? key}) : super(key: key);

  @override
  State<BaziXuanzePage> createState() => _BaziXuanzePageState();
}

class _BaziXuanzePageState extends State<BaziXuanzePage> {



  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: PageStyle.paColor.scaffoldBackgroudColor,
        appBar: AppBar(
          backgroundColor: PageStyle.paColor.homeHeadColor,
          elevation: 0,
          centerTitle: true,
          ///返回按钮
          leading: IconButton(
            icon: Icon(CupertinoIcons.back),
            onPressed: () {
              Get.back();
            },
          ),
          title: Text("综合排盘",
            style: PageStyle.paText.scaffoldTextStyle,),
          // actions: [
          //   Row(
          //     children: [
          //       GestureDetector(
          //         child: Container(
          //           margin:
          //           EdgeInsets.only(right: 8.w, bottom: 12.h, top: 12.w),
          //           child: Text(
          //             "推荐收益",
          //             // style: PageStyle.paText.fourteenwhiteTextStyle,
          //           ),
          //         ),
          //         onTap: () {
          //           // Get.to(tuiguangShouyiPage());
          //           print("点击了推荐收益");
          //         },
          //       )
          //     ],
          //   )
          // ],
        ),
        body: GetBuilder<BaziXuanzePageLogic>(
          init: BaziXuanzePageLogic(),
          builder: (baziController) {
            return Container(
              margin: EdgeInsets.only(
                  top: 20.h, left: 15.w, right: 15.w, bottom: 20.h),
              child: Column(
                children: [
                  Container(
                      color: Colors.white,
                      padding: EdgeInsets.only(
                          top: 20.h, left: 20.w, right: 20.w, bottom: 20.h),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Row(
                            children: [
                              TextFiledUtil(baziController.baziController),
                            ],
                          ),
                          PageStyle.paDiver.blackDiver,
                          SizedBox(
                            height: 10.h,
                          ),
                          Row(
                            children: [
                              baziController.leftButton(baziController.male, true, 1),
                              baziController.leftButton(
                                  baziController.female, false, 2),

                              ///撑开组件
                              Spacer(),
                              Row(
                                children: [
                                  baziController.getButton(
                                      baziController.gregorian, true, 1,context),
                                  baziController.getButton(
                                      baziController.lunar, false, 2,context),
                                  baziController.getButton(
                                      baziController.fourPillars, false, 3,context),
                                ],
                              ),
                            ],
                          ),
                          Container(
                            margin: EdgeInsets.fromLTRB(0.w, 20.h, 0.w, 0.h),
                            child: Row(
                              children: [
                                Obx(
                                      ()=> Text(
                                      baziController.timeAll.value =="" ? baziController.timesa.value:
                                      baziController.timeAll.value
                                  ),
                                ),

                              ],
                            ),
                          ),
                          PageStyle.paDiver.blackDiver,
                          Container(
                            margin: EdgeInsets.fromLTRB(0.w, 20.h, 0.w, 0.h),
                            child: Row(
                              children: [
                                InkWell(
                                  child: SizedBox(
                                    height: 20.h,
                                    child: Row(
                                      mainAxisAlignment: MainAxisAlignment.end,
                                      children: [
                                        Text(
                                          baziController.ProvinceCityTown(),
                                          textAlign: TextAlign.right,
                                        ),
                                      ],
                                    ),
                                  ),
                                  onTap: () {
                                    baziController.Pickes(context);
                                  },
                                ),
                              ],
                            ),
                          ),
                          PageStyle.paDiver.blackDiver,
                          Text("真太阳时：1990-01-01 00：00"),
                          Text("地址经纬度： 北纬39.53 东经116.42"),

                          // Pickers.showDatePicker(
                          //   context,
                          //   onConfirm: (p) {
                          //     setState(() {
                          //       stateText = '${p.year}-${p.month}-${p.day}';
                          //     });
                          //     print('longer >>> 返回数据：$p');
                          //   },
                          // );
                        ],
                      )),
                  SizedBox(
                    height: 15.h,
                  ),
                  OutlinedButton(
                    onPressed: () {
                      debugPrint("点击开始排盘");
                    },
                    child: Text(
                      "开始排盘",
                      style: PageStyle.paText.fourteenwhiteTextStyle,
                    ),
                    style: OutlinedButton.styleFrom(
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10.0),
                      ),
                      padding: EdgeInsets.symmetric(
                          vertical: 20.w, horizontal: 40.h),
                      minimumSize: Size(400.w, 40.h),
                      backgroundColor: PageStyle.paColor.black00,
                      primary:Colors.transparent,
                      // side: BorderSide(width: 1, color: Colors.grey),
                    ),
                  ),
                  SizedBox(height: 10.h,),
                  OutlinedButton(
                    onPressed: () {
                      debugPrint("排盘记录");
                    },
                    child: Text(
                      "排盘记录",
                      style: PageStyle.paText.fourteenwhiteTextStyle,
                    ),
                    style: OutlinedButton.styleFrom(
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10.0),
                      ),
                      padding: EdgeInsets.symmetric(
                          vertical: 20.w, horizontal: 40.h),
                      minimumSize: Size(400.w, 40.h),
                      backgroundColor: PageStyle.paColor.black00,
                      primary:Colors.transparent,
                      // side: BorderSide(width: 1, color: Colors.grey),
                    ),
                  ),
                ],
              ),
            );
          },
        ));
  }
}
